/**
 * 
 */
package cn.softTank.BpelModelImpl;

import java.util.ArrayList;
import java.util.List;

import org.dom4j.Element;

import cn.softTank.BpelModel.PartnerLink;

/**
 * @author Yuzone (smartzxy@gmail.com)
 *
 */
public class PartnerLinksImpl extends ExtensibleElementImpl implements
		cn.softTank.BpelModel.PartnerLinks {

	private List<PartnerLink> list;
	
	/* (non-Javadoc)
	 * @see cn.softTank.BpelModel.PartnerLinks#addPartnerLink(cn.softTank.BpelModel.PartnerLink)
	 */
	@Override
	public void addPartnerLink(PartnerLink value) {
		if(list==null)
			list=new ArrayList<PartnerLink>();
		list.add(value);
	}

	/* (non-Javadoc)
	 * @see cn.softTank.BpelModel.PartnerLinks#getPartnerLink()
	 */
	@Override
	public List<PartnerLink> getPartnerLink() {
		return list;
	}

	/* (non-Javadoc)
	 * @see cn.softTank.BpelModel.PartnerLinks#removePartnerLinkAt(int)
	 */
	@Override
	public void removePartnerLinkAt(int index) {
		this.list.remove(index);
	}

	/* (non-Javadoc)
	 * @see cn.softTank.BpelModel.PartnerLinks#setPartnerLink(java.util.List)
	 */
	@Override
	public void setPartnerLink(List<PartnerLink> value) {
		this.list=value;
	}
	@Override
	public Element toElement(){
		node=super.toElement();
		node.setName("partnerLinks");
		if(list!=null)
		for(int n=0; n<list.size(); n++){
			node.add(list.get(n).toElement());
		}
		return node;
	}

}
